<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>添加作品 - 系统后台 - {$Config.sitename}</title>
    <link rel="stylesheet" href="__CSS__/admin_inc.css" type="text/css">
    <link rel="stylesheet" href="__JS__/artDialog/skins/default.css" type="text/css">
    <script type="text/javascript">
        //全局变量
        var GV = {
            DIMAUB: "__ROOT__/",
            JS_ROOT: "__JS__/"
        };
    </script>
    <script src="__JS__/wind.js"></script>
    <script src="__JS__/jquery.min.js"></script>
    <script type="text/javascript">
    var cateid = "{$cateid}";
</script>
<style type="text/css">
.col-auto {
	overflow: hidden;
	_zoom: 1;
	_float: left;
	border: 1px solid #c2d1d8;
}
.col-right {
	float: right;
	width: 48%;
	overflow: hidden;
	margin-left: 6px;
	border: 1px solid #c2d1d8;
}

body fieldset {
	border: 1px solid #D8D8D8;
	padding: 10px;
	background-color: #FFF;
}
body fieldset legend {
    background-color: #F9F9F9;
    border: 1px solid #D8D8D8;
    font-weight: 700;
    padding: 3px 8px;
}
.list-dot{ padding-bottom:10px}
.list-dot li,.list-dot-othors li{padding:5px 0; border-bottom:1px dotted #c6dde0; font-family:"宋体"; color:#bbb; position:relative;_height:22px}
.list-dot li span,.list-dot-othors li span{color:#004499}
.list-dot li a.close span,.list-dot-othors li a.close span{display:none}
.list-dot li a.close,.list-dot-othors li a.close{ background: url("__IMAGES__/cross.png") no-repeat left 3px; display:block; width:16px; height:16px;position: absolute;outline:none;right:5px; bottom:5px}
.list-dot li a.close:hover,.list-dot-othors li a.close:hover{background-position: left -46px}
.list-dot-othors li{float:left;width:24%;overflow:hidden;}

    .attr{
        margin: 0px;
        padding: 10px;
        background: bisque;
        border: 1px dotted coral;
    }
    .attr ul{
        display: block;
    }
    .attr ul li{
        margin-top: 5px;
    }
    td.ship input,
    td.ship select{
        margin-bottom: 5px;
    }

    td#mt input{
        margin-top: 3px;
        width: 40%;
    }

    input[type=radio]{
        margin-bottom: 6px;
        border-radius: 8px;
    }
    .opt em{
        display: inline-block;
        margin-left: 10px;
        width: 100px;
        text-align: center;
        height: 80px;
        line-height: 80px;
        font-size: 20px;
        border: 1px solid #c1c1c1;
        background: #f0ead8;
        overflow: hidden;
        cursor: pointer;
    }
    .opt a{
        display: inline-block;
        margin-bottom: 30px;
        overflow: hidden;
    }


</style>
</head>
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
<form name="myform" id="myform" action="{:U('Works/add')}" method="post" class="J_ajaxForm" enctype="multipart/form-data">
<div class="col-right">
    <div class="table_full">
        <table width="100%">
            <tr>
                <td><b>作品主图</b></td>
            </tr>
            <tr>
                <td><div style="text-align: center;"><Form function="mainimage" parameter="image,image,$data['image'],works"/></div></td>
            </tr>
            <tr>
                <td><input type="button" value="+添加用料" class="btn" name="addmt" /></td>
            </tr>
            <tr>
                <td id="mt"></td>
            </tr>

            <tr>
                <td><input type="button" value="+添加做法" class="btn" name="addopt" /></td>
            </tr>
            <tr>
                <td id="opt"></td>
            </tr>
        </table>
    </div>
</div>
<div class="col-auto">
    <div class="h_a">信息发布</div>
    <div class="table_full">
        <table width="100%">
            <tr>
                <th width="80">栏目<span class="require_red">*</span></th>
                <td><select name="cateid">{$category}</select></td>
            </tr>
            <tr>
                <th width="80">名称<span class="require_red">*</span></th>
                <td><input type="text" style="width:320px;" name="title" id="title" class="input input_hd J_title_color" placeholder="请输入产品名称" onkeyup="strlen_verify(this, 'title_len', 30)" />
                    <span>还可输入<B><span id="title_len">30</span></B> 个字符</span> <span></span></td>
            </tr>
            <tr>
                <th width="80">内容</th>
                <td><textarea name="content" id="" cols="90%" rows="10"></textarea></td>
            </tr>
            <tr>
                <th width="80">小贴士{$ids}</th>
                <td><textarea name="note" id="" cols="90%" rows="5"></textarea></td>
            </tr>
            <tr>
                <th width="80">状态</th>
                <td>
                    <span class="switch_list cc">
                    <label><input type="radio" name="status" value="1" checked><span>审核</span></label>
                    <label><input type="radio" name="status" value="0"><span>待审核</span></label>
                 </span>
                </td>
            </tr>
            <tr>
                <th width="80">推荐</th>
                <td>
                    <span class="switch_list cc">
                    <label><input type="radio" name="iftj" value="1" ><span>推荐</span></label>
                    <label><input type="radio" name="iftj" value="0" checked><span>不推荐</span></label>
                 </span>
                </td>
            </tr>
            <tr>
                <th width="80">推荐首页</th>
                <td>
                    <span class="switch_list cc">
                    <label><input type="radio" name="ifindex" value="1" ><span>推荐</span></label>
                    <label><input type="radio" name="ifindex" value="0" checked><span>不推荐</span></label>
                 </span>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<div class="btn_wrap" style="z-index:999;text-align: center;">
    <div class="btn_wrap_pd">
        <input type="hidden" name="type" value="1 "/>
        <button class="btn btn_submit J_ajax_submit_btn"type="submit">提交</button>
        <button class="btn btn_close J_ajax_close_btn" type="button">关闭</button>
    </div>
</div>
</form>
</div>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript" src="__JS__/content_addtop.js"></script>
<script type="text/javascript"> 
$(function () {
	$(".J_ajax_close_btn").on('click', function (e) {
	    e.preventDefault();
	    Wind.use("artDialog", function () {
	        art.dialog({
	            id: "question",
	            icon: "question",
	            fixed: true,
	            lock: true,
	            background: "#CCCCCC",
	            opacity: 0,
	            content: "您确定需要关闭当前页面嘛？",
	            ok:function(){
					setCookie("refersh_time",1);
					window.close();
					return true;
				}
	        });
	    });
	});

    /**
     * 选择意向判断个数
     */
    $("input[name='mindid']").on('click',function(){
        var num=$("input[name=mindid]:checked").length;
        if(num>3){
            alert('最多只能勾选三个交换意向');
            return false;
        }
    })

    /*添加用料*/
    $("input[name='addmt']").on('click', function (){
        var arr="<span>"
            arr+="<input type='text' class='input' name='mname[]' placeholder='用料名称'/>";
            arr+="<input type='text' class='input' name='mvalue[]' placeholder='用量'/> <a class='delmt' href='javascript:void(0)'>删除</a>";
            arr+="</span>";
        $("#mt").append(arr);

        $(".delmt").on("click",function(){
            $(this).parent('span').remove();
            return false;
        })
    });

    /**
     * 添加操作步骤
     */
     $('input[name="addopt"]').on('click', function (){
         var arr="<div class='opt'>"
             arr+="<textarea cols='40%' rows='10' name='scontent[]'></textarea>";
             arr+="<span><Form function='hbqImages' parameter='simage[],bluk,,works' /></span>";
             arr+="<span class='delbtn'><a class='delopt' href='javascript:void(0)'>删除</a></span>";
             arr+="</div>";
        $("#opt").append(arr);

        $(".delopt").on("click",function(){
            $(this).parent().parent('div').remove();
            return false;
        })
    });

    /**
     * 添加多个运费
     */
    $("#shipway").on('change',function(){
        var txt=$("#shipway option:selected").text();
        var value=$("#shipway option:selected").val();
        $("#shipway").parent().append("<p id='ship"+value+"'><input type='text' value="+txt+" class='input' name='shipways'/> <input type='text' class='input' size='3' name='shipfees[]' value='0' /> <input type='hidden' name='shipid[]' value="+value+" /> <a href=\"javascript:remove_ship('ship"+value+"')\">删除</a></p>");
    });
});




//remove_ship
function remove_ship(str){
    $('#' +str).remove();
}


</script>
</body>
</html>